/*
* Author: Sowmya Kameswaran
*/
package com.foo.AnalyzedData;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;


public class AnalysisDataClient 
{
	AnalyzedDataProviderRemote dataprovider = null;
	public AnalysisDataClient()
	{
		try
		{
			Properties properties = new Properties();
			properties.put(Context.PROVIDER_URL, "jnp://localhost:1099");
			properties.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
			properties.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
			Context ctx = new InitialContext(properties);
			Object ref = ctx.lookup("AnalyzedDataProvider/remote");
			//DataProviderRemote 
			dataprovider = (AnalyzedDataProviderRemote) PortableRemoteObject.narrow(ref, AnalyzedDataProviderRemote.class);

		}
		catch(Exception e)
		{
			e.printStackTrace();
		}	
	}
	public void analyzedinfo(String exampleName) 
	{
		dataprovider.Analyzedinfo(exampleName);
		System.out.println("Sending data to server");
	}
}
